//定义一个全局变量XMLHttpRequest
var xmlHttp;
function createHttpRequest() {
	// IE7+ , 谷歌，火狐。。浏览器
	if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
		// alert("window.XMLHttpRequest");
	} else {
		// window.ActiveXObject ; IE5,IE6
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		// alert("window.ActiveXObject");
	}
}
function delRow(Node, nid) {
	var row = Node.parentNode.parentNode.rowIndex; // 删除行所在表格中的位置
	var url = "McTypeServlet?task=del&date=" + new Date().getTime();
	$.ajax({
		type : "post",
		url : url,
		data : "nid=" + nid,
		dataType : "json",
		success : function(json) {
			alert("json=" + json);
		}
	});
	document.getElementById("order").deleteRow(row);
}
function upRow(Node) {
	var row = Node.parentNode.parentNode; // 修改行所在表格中的位置
	var col = row.cells;
	alert(row);
	if (col[0].firstChild.getAttribute("readonly") == 'readonly') {
		col[0].firstChild.removeAttribute("readonly");
		col[1].firstChild.removeAttribute("readonly");
		col[2].firstChild.removeAttribute("readonly");
		Node.innerHTML = "确定";
	} else {
		var nid = col[0].firstChild.value;
		var sname = col[1].firstChild.value;
		var npid = col[2].firstChild.value;
		var url = "McTypeServlet?task=update&date=" + new Date().getTime();
		$.ajax({
			type : "post",
			url : url,
			data : "nid=" + nid+"&sname="+sname+"&npid="+npid,
			dataType : "json",
			success : function(json) {
				alert("json=" + json);
			}
		});
		col[0].firstChild.setAttribute("readonly", "readonly");
		col[1].firstChild.setAttribute("readonly", "readonly");
		col[2].firstChild.setAttribute("readonly", "readonly");
		Node.innerHTML = "修改";
	}
}
function show(Node, i) {
	var tbody = document.getElementById("tbody" + i);
	if (tbody.style.display == "none") {
		tbody.style.display = "";
		Node.innerHTML = "收起";
	} else {
		tbody.style.display = "none";
		Node.innerHTML = "展开";
	}
}